//
//  BLUIView.swift
//  yiplayer
//
//  Created by wkun on 2024/6/6.
//

import UIKit

class BLUIView: UIView {

    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
}


extension UIView{
    
    func currViewController() -> UIViewController? {
        return self.getViewController()
    }
    
    func getViewController()->UIViewController?{
        var next:UIView? = self
        repeat{
            if let nextResponder = next?.next{
                if(nextResponder.isKind(of: UIViewController.self)){
                    return (nextResponder as! UIViewController)
                }
            }
            next = next?.superview
        }while next != nil
        return nil
    }
}
